

#ifndef ORGANIZATIONDAO_STRUCT_H
#define ORGANIZATIONDAO_STRUCT_H

#include <stdint.h>
#include <string>
#include <iostream>
#include "libc2c/byte_stream.h"
#include "app_platform/intf_service_object.h"
#include <set>	
#include <map>	
#include <vector>	
#include "erp/organization/ddo/branchddo_organization.h"	
#include "erp/organization/ddo/organizationfilterddo_organization.h"	

namespace erp
{
namespace organization
{
namespace dao
{

	const uint32_t ORGANIZATIONDAO_DELETEBRANCH_REQ_CMD_ID = 0xC04E1802; /// 请求命令号
	const uint32_t ORGANIZATIONDAO_DELETEBRANCH_RESP_CMD_ID = 0xC04E8802; /// 回应命令号
	

	const uint32_t ORGANIZATIONDAO_FINDBRANCH_REQ_CMD_ID = 0xC04E1804; /// 请求命令号
	const uint32_t ORGANIZATIONDAO_FINDBRANCH_RESP_CMD_ID = 0xC04E8804; /// 回应命令号
	

	const uint32_t ORGANIZATIONDAO_GETBRANCH_REQ_CMD_ID = 0xC04E1803; /// 请求命令号
	const uint32_t ORGANIZATIONDAO_GETBRANCH_RESP_CMD_ID = 0xC04E8803; /// 回应命令号
	

	const uint32_t ORGANIZATIONDAO_MODIFYBRANCH_REQ_CMD_ID = 0xC04E1801; /// 请求命令号
	const uint32_t ORGANIZATIONDAO_MODIFYBRANCH_RESP_CMD_ID = 0xC04E8801; /// 回应命令号
	


const uint16_t ORGANIZATIONDAO_MAX_PROTOCAL_VERSION = 2; //>平台支持的最大协议版本号


///////////////////////////// STRUCTS /////////////////////////////////////////////////
	/**
	 *
 	 * 
	 *
 	 * @date 2013-10-23 11:04:01
 	 * @version 0
	 */	
	struct COrganizationDaoDeleteBranchReq : public IServiceObject, public ISerializableXML
	{
		std::string machineKey;
		std::string source;
		uint32_t sceneId;
		uint32_t option;
		std::set<uint64_t > branchId;
		std::string inReserve;
		std::string errmsg;
		std::map<uint64_t,uint32_t > errorCode;
		std::map<uint64_t,std::string > errorMsg;
		std::string outReserve;
	
	    virtual uint32_t getCmdId() const { return ORGANIZATIONDAO_DELETEBRANCH_REQ_CMD_ID; }
		virtual bool Serialize(CByteStreamNetwork& bs)
		{
			//检查协议的版本号
		    //if(bs.getVersion() > ORGANIZATIONDAO_MAX_PROTOCAL_VERSION)
		    //    return false;
			bs & machineKey;
			bs & source;
			bs & sceneId;
			bs & option;
			bs & branchId;
			bs & inReserve;
		    return bs.isGood();
		}
		
	    virtual void Dump(std::ostream& os)	{}
	
		virtual bool FromXML(const std::string& sXMLContent) { return true; }
		virtual bool ToXML(std::string& sXMLContent) { return true; }
	};
	
	/**
	 *
 	 * 
	 *
 	 * @date 2013-10-23 11:04:01
 	 * @version 0
	 */	
	struct COrganizationDaoDeleteBranchResp : public IServiceObject, public ISerializableXML
	{
		uint32_t dwResult;
		std::string errmsg;
		std::map<uint64_t,uint32_t > errorCode;
		std::map<uint64_t,std::string > errorMsg;
		std::string outReserve;
		
	    virtual uint32_t getCmdId() const { return ORGANIZATIONDAO_DELETEBRANCH_RESP_CMD_ID; }
		virtual bool Serialize(CByteStreamNetwork& bs)
		{
		    bs & dwResult;
			bs & errmsg;
			bs & errorCode;
			bs & errorMsg;
			bs & outReserve;

		    return bs.isGood();
		}
	    virtual void Dump(std::ostream& os)	{}
	
		virtual bool FromXML(const std::string& sXMLContent) { return true; }
		virtual bool ToXML(std::string& sXMLContent) { return true; }
	};	
	/**
	 *
 	 * 
	 *
 	 * @date 2013-10-23 11:04:01
 	 * @version 0
	 */	
	struct COrganizationDaoFindBranchReq : public IServiceObject, public ISerializableXML
	{
		std::string machineKey;
		std::string source;
		uint32_t sceneId;
		uint32_t option;
		erp::organization::ddo::COrganizationFilterDdo filter;	
		std::string inReserve;
		std::string errmsg;
		uint32_t total;
		std::vector<erp::organization::ddo::CBranchDdo > branch;
		std::string outReserve;
	
	    virtual uint32_t getCmdId() const { return ORGANIZATIONDAO_FINDBRANCH_REQ_CMD_ID; }
		virtual bool Serialize(CByteStreamNetwork& bs)
		{
			//检查协议的版本号
		    //if(bs.getVersion() > ORGANIZATIONDAO_MAX_PROTOCAL_VERSION)
		    //    return false;
			bs & machineKey;
			bs & source;
			bs & sceneId;
			bs & option;
			filter.Serialize(bs);
			bs & inReserve;
		    return bs.isGood();
		}
		
	    virtual void Dump(std::ostream& os)	{}
	
		virtual bool FromXML(const std::string& sXMLContent) { return true; }
		virtual bool ToXML(std::string& sXMLContent) { return true; }
	};
	
	/**
	 *
 	 * 
	 *
 	 * @date 2013-10-23 11:04:01
 	 * @version 0
	 */	
	struct COrganizationDaoFindBranchResp : public IServiceObject, public ISerializableXML
	{
		uint32_t dwResult;
		std::string errmsg;
		uint32_t total;
		std::vector<erp::organization::ddo::CBranchDdo > branch;
		std::string outReserve;
		
	    virtual uint32_t getCmdId() const { return ORGANIZATIONDAO_FINDBRANCH_RESP_CMD_ID; }
		virtual bool Serialize(CByteStreamNetwork& bs)
		{
		    bs & dwResult;
			bs & errmsg;
			bs & total;
			bs & branch;
			bs & outReserve;

		    return bs.isGood();
		}
	    virtual void Dump(std::ostream& os)	{}
	
		virtual bool FromXML(const std::string& sXMLContent) { return true; }
		virtual bool ToXML(std::string& sXMLContent) { return true; }
	};	
	/**
	 *
 	 * 
	 *
 	 * @date 2013-10-23 11:04:01
 	 * @version 0
	 */	
	struct COrganizationDaoGetBranchReq : public IServiceObject, public ISerializableXML
	{
		std::string machineKey;
		std::string source;
		uint32_t sceneId;
		uint32_t option;
		std::set<uint64_t > branchId;
		std::string inReserve;
		std::string errmsg;
		std::map<uint64_t,uint32_t > errorCode;
		std::map<uint64_t,std::string > errorMsg;
		std::map<uint64_t,erp::organization::ddo::CBranchDdo > branch;
		std::string outReserve;
	
	    virtual uint32_t getCmdId() const { return ORGANIZATIONDAO_GETBRANCH_REQ_CMD_ID; }
		virtual bool Serialize(CByteStreamNetwork& bs)
		{
			//检查协议的版本号
		    //if(bs.getVersion() > ORGANIZATIONDAO_MAX_PROTOCAL_VERSION)
		    //    return false;
			bs & machineKey;
			bs & source;
			bs & sceneId;
			bs & option;
			bs & branchId;
			bs & inReserve;
		    return bs.isGood();
		}
		
	    virtual void Dump(std::ostream& os)	{}
	
		virtual bool FromXML(const std::string& sXMLContent) { return true; }
		virtual bool ToXML(std::string& sXMLContent) { return true; }
	};
	
	/**
	 *
 	 * 
	 *
 	 * @date 2013-10-23 11:04:01
 	 * @version 0
	 */	
	struct COrganizationDaoGetBranchResp : public IServiceObject, public ISerializableXML
	{
		uint32_t dwResult;
		std::string errmsg;
		std::map<uint64_t,uint32_t > errorCode;
		std::map<uint64_t,std::string > errorMsg;
		std::map<uint64_t,erp::organization::ddo::CBranchDdo > branch;
		std::string outReserve;
		
	    virtual uint32_t getCmdId() const { return ORGANIZATIONDAO_GETBRANCH_RESP_CMD_ID; }
		virtual bool Serialize(CByteStreamNetwork& bs)
		{
		    bs & dwResult;
			bs & errmsg;
			bs & errorCode;
			bs & errorMsg;
			bs & branch;
			bs & outReserve;

		    return bs.isGood();
		}
	    virtual void Dump(std::ostream& os)	{}
	
		virtual bool FromXML(const std::string& sXMLContent) { return true; }
		virtual bool ToXML(std::string& sXMLContent) { return true; }
	};	
	/**
	 *
 	 * 
	 *
 	 * @date 2013-10-23 11:04:01
 	 * @version 0
	 */	
	struct COrganizationDaoModifyBranchReq : public IServiceObject, public ISerializableXML
	{
		std::string machineKey;
		std::string source;
		uint32_t sceneId;
		uint32_t option;
		erp::organization::ddo::CBranchDdo branch;	
		std::string inReserve;
		std::string errmsg;
		std::string outReserve;
	
	    virtual uint32_t getCmdId() const { return ORGANIZATIONDAO_MODIFYBRANCH_REQ_CMD_ID; }
		virtual bool Serialize(CByteStreamNetwork& bs)
		{
			//检查协议的版本号
		    //if(bs.getVersion() > ORGANIZATIONDAO_MAX_PROTOCAL_VERSION)
		    //    return false;
			bs & machineKey;
			bs & source;
			bs & sceneId;
			bs & option;
			branch.Serialize(bs);
			bs & inReserve;
		    return bs.isGood();
		}
		
	    virtual void Dump(std::ostream& os)	{}
	
		virtual bool FromXML(const std::string& sXMLContent) { return true; }
		virtual bool ToXML(std::string& sXMLContent) { return true; }
	};
	
	/**
	 *
 	 * 
	 *
 	 * @date 2013-10-23 11:04:01
 	 * @version 0
	 */	
	struct COrganizationDaoModifyBranchResp : public IServiceObject, public ISerializableXML
	{
		uint32_t dwResult;
		std::string errmsg;
		std::string outReserve;
		
	    virtual uint32_t getCmdId() const { return ORGANIZATIONDAO_MODIFYBRANCH_RESP_CMD_ID; }
		virtual bool Serialize(CByteStreamNetwork& bs)
		{
		    bs & dwResult;
			bs & errmsg;
			bs & outReserve;

		    return bs.isGood();
		}
	    virtual void Dump(std::ostream& os)	{}
	
		virtual bool FromXML(const std::string& sXMLContent) { return true; }
		virtual bool ToXML(std::string& sXMLContent) { return true; }
	};	

}
}
}

#endif /* ORGANIZATIONDAO_STRUCT_H */

